$prefixCls: 'xf';
@import './var.scss';
@import './animation.scss';

.fy{
  $fy: &;

  //  动画效果隐藏
  &-transition{
    visibility: hidden;
    transition-timing-function: ease;
    transition-duration: 200ms;
    transition-property: transform, opacity, visibility;
    //  渐隐渐出过渡
    &.fade{opacity: 0;}
    //  由上至下过渡
    &.slide-top{transform: translateY(-100%);}
    //  由右至左过渡
    &.slide-right{transform: translateX(100%);}
    //  由下至上过渡
    &.slide-bottom{transform: translateY(100%);}
    //  由左至右过渡
    &.slide-left{transform: translateX(-100%);}
    //  由下至上过渡（水平垂直居中）
    &.slide-hor-center{transform: translate(-50%, 50vh);}
    //  由小到大过渡
    &.zoom-in{transform: scale(0.8);}
    //  由大到小过渡
    &.zoom-out{transform: scale(1.2);}
  }

  //  动画效果显示
  &-transition.show{
    visibility: visible;
    //  渐隐渐出过渡
    &.fade{opacity: 1;}
    //  由上至下过渡
    &.slide-top{transform: translateY(0);}
    //  由右至左过渡
    &.slide-right{transform: translateX(0);}
    //  由下至上过渡
    &.slide-bottom{transform: translateY(0);}
    //  由左至右过渡
    &.slide-left{transform: translateX(0);}
    //  由下至上过渡（水平垂直居中）
    &.slide-hor-center{transform: translate(-50%, -50%);}
    //  由小到大过渡
    &.zoom-in{transform: scale(1);}
    //  由大到小过渡
    &.zoom-out{transform: scale(1);}
  }



  //  遮罩
  &-mask{
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    position: fixed;
    background: rgba(0, 0, 0, 0.4);
  }

  //  全屏
  &-full{
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    position: fixed;
  }

  //  弹出窗口
  &-popup{
    position: fixed;
    background: #fff;
    $popup: &;

    //  顶部弹出
    &--top{
      top: 0;
      left: 0;
      right: 0;
      &#{$popup}--round {
        overflow: hidden;
        border-radius: 0 0 40px 40px;
      }
    }

    //  底部弹出
    &--bottom{
      left: 0;
      right: 0;
      bottom: 0;
      &#{$popup}--round {
        overflow: hidden;
        border-radius: 40px 40px 0 0;
      }
    }
  }


  //  弹窗
  &-modal{
    $modal: &;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 800;
    position: fixed;

    //  弹窗遮罩
    #{$fy}-mask{
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      position: absolute;
      background: rgba(0, 0, 0, 0.4);
    }

    //  弹窗内容
    #{$fy}-container{
      top: 50%;
      left: 50%;
      position: absolute;
      transform: translate(-50%, -50%);
    }

    &__b{
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: $min-zIndex;
      position: fixed;
      &#{$modal}--active{
        .modal-mask{
          opacity: 1;
        }

        .modal-container{
          transform: translate(-50%, -50%);
          animation: dialogue-in 300ms ease-out;
        }
      }

      //  弹窗遮罩
      .modal-mask{
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        opacity: 0;
        position: absolute;
        transition: all 300ms;
        background: rgba(0, 0, 0, 0.4);
      }

      @keyframes dialogue-in{
        0% {transform: translate(-50%, 50vh);}
        //90% {transform: translate(-50%, -50%);}
        //95% {transform: translate(-50%, calc(-50% + 30px));}
        100% {transform: translate(-50%, -50%);}
      }

      //  弹窗内容
      .modal-container{
        top: 50%;
        left: 50%;
        position: absolute;
        transform: translate(-50%, 50vh);
      }
    }
  }


  &-scrollbar{
    &::-webkit-scrollbar {/*滚动条整体样式*/
      width: 6px;
      z-index: 11;
      display: inline;
    }
    &::-webkit-scrollbar:horizontal {
      height: 6px
    }
    &::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
      border-radius: 5px;
      width: 6px;
      background: #b4bccc;
    }
    &::-webkit-scrollbar-track {/*滚动条里面轨道*/
      -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
      border-radius: 10px;
      background: #EDEDED;
    }
    &::-webkit-scrollbar-corner,&::-webkit-scrollbar-track {
      background: #fff;
    }
    &::-webkit-scrollbar-track-piece {
      background: #fff;
      width: 6px;
    }
  }
}


/* Popup */
$fy-popup-transition: transform $animation-duration-fast !default;
$fy-popup-background-color: #fff !default;
$fy-popup-round-border-radius: 30px;

.xf{
  $xf: &;
  &-page{
    z-index: 0;
    display: flex;
    position: relative;
    min-height: 100vh;
    flex-direction: column;
    &-fixed-bg{
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: -1;
      content: '';
      position: fixed;
      background-size: contain;
      background-color: $theme_bg_color;
      background-repeat: no-repeat;
      background-position: top;
      background-image: '@/asstes/images/user';
    }
    //&:before{
    //  top: 0;
    //  left: 0;
    //  right: 0;
    //  bottom: 0;
    //  z-index: -1;
    //  content: '';
    //  position: fixed;
    //  background-size: contain;
    //  background-image: var(--bg-image);
    //  background-repeat: no-repeat;
    //  background-position: top;
    //}
  }

  &-btn{
    color: $button-def-color;
    margin: 0;
    display: flex;
    position: relative;
    font-size: 32px;
    background: $button-def-background-color;
    align-items: center;
    justify-content: center;
    &:after{
      border-color: #333;
    }
    //  按钮 hover
    &.button-hover{
      &:after{
        background: rgba(0, 0, 0, .2);
      }
    }
    //  主要颜色
    &[type=primary], &-primary{
      color: #fff;
      background: $button-primary-background-color;
      &:after{
        border: none;
      }
    }
    //  红色按钮
    &[type=warn], &-danger{
      color: $button-danger-color;
      background: $button-danger-background-color;
      &:after{
        border: none;
      }
    }
    //  按钮圆角
    &-round{
      border-radius: 200px;
      &:after{
        border-radius: 400px;
      }
    }
  }

  //  弹窗遮罩
  &-overlay {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: $fy-popup-zIndex - 1;
    position: fixed;
    background: rgba(0, 0, 0, 0.7);
  }

  //  弹出窗口
  &-popup{
    $popup: &;
    z-index: $fy-popup-zIndex;
    position: fixed;
    max-height: 100%;
    //overflow-y: auto;
    background: $fy-popup-background-color;
    transition: $fy-popup-transition;

    //  顶部弹出
    &--top{
      top: 0;
      left: 0;
      right: 0;
      &#{$popup}--round {
        border-radius: 0 0 $fy-popup-round-border-radius $fy-popup-round-border-radius;
      }
    }

    &--left {
      top: 50%;
      left: 0;
      transform: translateY(-50%);
    }

    &--right {
      top: 50%;
      right: 0;
      transform: translateY(-50%);
    }

    //  底部弹出
    &--bottom{
      left: 0;
      right: 0;
      bottom: 0;
      &#{$popup}--round {
        border-radius: $fy-popup-round-border-radius $fy-popup-round-border-radius 0 0;
      }
    }

    &--center{
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
  }

  &-slide-enter {
    transition-timing-function: ease-out;
  }

  &-slide-leave {
    transition-timing-function: ease-in;
  }

  &-fade-enter{
    animation: 300ms xf-fade-in both ease-out;
  }

  &-fade-leave{
    animation: 300ms xf-fade-out both ease-in;
    visibility: hidden;
  }

  &-slide-top{
    transform: translateY(-100%);
  }
  &-slide-left{
    transform: translate(-100%, -50%);
  }
  &-slide-right{
    transform: translate(100%, -50%);
  }
  &-slide-bottom{
    transform: translateY(100%);
  }

  @keyframes xf-fade-in {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
      //visibility: visible;
    }
  }

  @keyframes xf-fade-out {
    from {
      opacity: 1;
    }
    to {
      opacity: 0;
      //visibility: hidden;
    }
  }

  &-bg{
    &-img{
      top: 0;
      left: 0;
      right: 0;
      width: 100%;
      z-index: -1;
      position: fixed;
    }
    &-color:before{
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      content: '';
      z-index: -1;
      position: fixed;
      background: $theme_bg_color;
    }
  }

  //  弹出窗口
  &-modal{
    $modal: &;
    z-index: $fy-popup-zIndex;
    position: fixed;
    background: $fy-popup-background-color;
    transition: $fy-popup-transition;
    //  底部弹出
    &--bottom{
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      &-slide{
        transform: translate(-50%, calc(50vh + 50%));
      }
    }
  }
}
